package com.haruhi.bot.endpoint.ws.model;

import com.haruhi.bot.endpoint.ws.client.ClientEndpoint;
import com.haruhi.bot.endpoint.ws.server.ServerEndpoint;
import org.springframework.web.socket.WebSocketSession;

import javax.websocket.Session;

public class MessageBox {

    private ServerEndpoint server;
    private ClientEndpoint client;
    private final ProxySession session;
    private final String message;

    public MessageBox(WebSocketSession webSocketSession,ServerEndpoint server,String messageStr){
        if(webSocketSession == null || server == null || messageStr == null){
            throw new NullPointerException();
        }
        this.session = new ProxySession(webSocketSession);
        this.server = server;
        this.message = messageStr;
    }

    public MessageBox(Session session,ClientEndpoint client,String messageStr){
        if(session == null || client == null || messageStr == null){
            throw new NullPointerException();
        }
        this.session = new ProxySession(session);
        this.client = client;
        this.message = messageStr;
    }


    public ServerEndpoint getServer() {
        return server;
    }

    public ClientEndpoint getClient() {
        return client;
    }

    public ProxySession getSession() {
        return session;
    }

    public String getMessage() {
        return message;
    }

}
